:: dev.bat
@echo off
title Multilang Development Environment

echo Starting Multilang Development Environment...
echo ========================================

:: 检查是否安装了必要的程序
where php >nul 2>nul
if %errorlevel% neq 0 (
    echo Error: PHP is not installed or not in PATH
    pause
    exit /b
)

where npm >nul 2>nul
if %errorlevel% neq 0 (
    echo Error: Node.js/NPM is not installed or not in PATH
    pause
    exit /b
)

:: 启动PHP服务器
echo Starting PHP Server...
start "PHP Server" cmd /k "php think run"

:: 等待2秒
timeout /t 2 >nul

:: 启动前端开发服务器
echo Starting Frontend Server...
start "Frontend Server" cmd /k "cd vue && npm run dev"

echo.
echo ========================================
echo Development servers are running!
echo PHP Server: http://localhost:8000
echo Frontend Server: http://localhost:5173
echo ========================================
echo.
echo Press any key to stop all servers...

pause >nul

:: 关闭所有相关的命令窗口
taskkill /FI "WINDOWTITLE eq PHP Server*" /F
taskkill /FI "WINDOWTITLE eq Frontend Server*" /F

echo All servers stopped.
timeout /t 2 >nul